package gold.digger;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC326 {
    public long startExecuteTime = System.currentTimeMillis();


    public boolean isPowerOfThree(int n) {
        long num = n;
        return num <= 0 ? false : (long) Math.pow(3, (long) (Math.round((Math.log(num) / Math.log(3))))) == num;
    }


    public static void main(String[] args) {
        LC326 an = new LC326();
        System.out.println(an.isPowerOfThree(2147483647));

        System.out.println("\nanswer total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
